/***************************************************************************\
 * The Mattise Kernel														*
 * Copyright 2007 Matthew Iselin											*
 * Licensed under the GPL													*
 *																			*
 * memory.h																	*
 *																			*
 * Memory management and utility functions.									*
 *																			*
\***************************************************************************/

#ifndef MEMORY_H
#define MEMORY_H
#include <stdint.h>
#include "multiboot.h"

// memset, sets a range of memory
void memset( void* ptr, unsigned char dat, int len );

// memcpy, copies a block of data
void *memcpy( void *dest, const void *src, int n );

// memory management
struct tkheap{
	uint32_t flags;
	uint16_t size;
};
struct tkheapHdr{
	struct tkheap 	*heap;
	uint32_t		size;
}; typedef struct tkheapHdr HEAP; typedef HEAP* PHEAP;

#define kmalloc kheap_alloc
#define kfree kheap_free

void* kheap_alloc(unsigned int size);
void kheap_free(void *ptr);
void kheap_init(unsigned int address, unsigned int size);
#endif

